package com.itany.corejava.entity;

import com.itany.corejava.code17_设计模式.工厂模式.ObjectFactory;

import java.util.Date;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年12月19日 15:19
 */
public class User {
    private Integer id;
    private String username;
    private String password;
    private String phone;

    //在一个类中使用由工厂创建的对象时候，加载时机必须必User早
    private Address address= (Address) ObjectFactory.getObject("address");
    private Date date= (Date) ObjectFactory.getObject("date");

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", phone='" + phone + '\'' +
                ", address=" + address +
                ", date=" + date +
                '}';
    }
}
